﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
using Nivdal.AuxCode;

namespace Nivdal
{
    public partial class RemovedFeedback : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write(CultureInfo.CurrentCulture.ToString());
            

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["UserId"] != "" && Request.QueryString["UserId"] != null)
            {
                string UserFeedbackIp = Request.ServerVariables["REMOTE_ADDR"].ToString();
                GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData(); ;
                string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                System.Data.SqlClient.SqlConnection
                strConnection = new System.Data.SqlClient.SqlConnection(conn);
                string StrSQL = "[dbo].[Nivdal_AddRemovedFeedback]";
                System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(StrSQL, strConnection);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@IP", Request.ServerVariables["REMOTE_ADDR"].ToString()));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@UserId", Request.QueryString["UserId"]));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q1", CheckBox1.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q2", CheckBox2.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q3", CheckBox3.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q4", CheckBox4.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q5", CheckBox5.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q6", CheckBox6.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q7", CheckBox7.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q8", CheckBox8.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Q9", CheckBox9.Checked));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@R1", TechnicalTextBox.Text.ToString().Trim()));
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@R2", OtherTextBox.Text.ToString().Trim()));
                strConnection.Open();
                try
                {

                    cmd.ExecuteNonQuery();
                    this.MessageLabel.Text = Resources.Resource.LeavingNivdal_FeedBackSentSuccessfully;
                }
                catch (Exception SQLDBException)
                {
                    MessageLabel.Text = SQLDBException.ToString();
                    return;

                }

                finally
                {
                    strConnection.Close();
                }

            }

            else
                this.MessageLabel.Text = Resources.Resource.Uups_ErrorLabel;
                
        }

        protected override void InitializeCulture()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(CultureInfo.CurrentCulture.ToString());
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.ToString());
        }

       
    }
}